
import VueRouter from 'vue-router';

import historicalData from "@/components/History/historicalData.vue";
import category from "@/components/Category/category.vue";
import UserManage from "@/components/Managment/UserManage.vue";
import parameterManage from "@/components/Parameter/parameterManage.vue";
import AddCategory from "@/components/Category/AddCategory.vue";
import parallelComp from "@/components/Visual/parallelComp.vue";
import control from "@/components/Controll/Control.vue";
import TempAirGrid from "@/components/Visual/TempAirGrid.vue";
import Home from "@/components/Home.vue";
import Index from "@/components/Index.vue";
import Login from "@/components/Login.vue";
import Home2 from "@/components/Home2.vue";
import Home3 from "@/components/Home3.vue";

const routes = [
    // 先跳过登录界面
    {
         path:'/',
         name:'login',
         component:Login
     },
    {
        path:'/Index',
        name:'index',
        component:Index,
        children:[
            {
                path: '/historicalData',
                name: "历史数据",
                component: historicalData
            },
            {
                path: '/category',
                name: "种类分类呈现",
                component: category
            },
            {
                path: '/addCategory',
                name: "种类分类添加",
                component: AddCategory
            },
            {
                path: '/UserManage',
                name: "用户管理",
                component: UserManage
            },
            {
                path: '/parameter',
                name: "参数管理",
                component: parameterManage
            },
            {
                path:'/parallelComp',
                name:'横向对比图',
                component:parallelComp
            },
            {
                path:'/Home',
                name:'home',
                meta:{
                    title:'首页'
                },
                component:Home
            },
            {
                path: '/home2',
                name: 'home2',
                meta: {
                    title: '首页2'
                },
                component: Home2
            },
            {
                path: '/home3',
                name: 'home3',
                meta: {
                    title: '首页3'
                },
                component: Home3
            },
            {
                path: '/control',
                name:'control',
                meta: {
                    title: '定时管理'
                },
                component: control
            },
            {
                path: '/tempAirGird',
                name:'tempAirGird',
                meta: {
                    title: '气流炉热网格'
                },
                component: TempAirGrid
            },
        ]
    }
]

const router = new VueRouter({
    mode:'history',
    routes
})

export function resetRouter() {
    router.matcher = new VueRouter({
        mode:'history',
        routes: []
    })
}
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to) {
    return VueRouterPush.call(this, to).catch(err => err)
}
export  default router;
